<template>
	<view class="line-h-xmd">

		<view class="invitetitle">
			<view class="invitetitle-em"></view>
			<view class="invitetitle-text">商家信息</view>
		</view>

		<!-- <view class="d-flex j-sb a-center">
			<view>
				<view>姓名: {{factory_info_data.boss_name}}</view>
				<view>个人电话: {{factory_info_data.boss_tel}}</view>
			</view>

			<view><image :src="factory_info_data.head_url" @tap="openhead(0, 'center')" class="img" /></view>
		</view> -->

		<!-- <divider /> -->

		<view class="d-flex j-sb a-center">
			<view class="mr-3">
				<view><span style="color: #777;">商家名称：</span>{{factory_info_data.name}}</view>
				<view><span style="color: #777;">商家电话：</span>{{factory_info_data.tel}}</view>
				<view><span style="color: #777;">商家地址：</span>{{factory_info_data.address}}</view>
			</view>
		</view>
		<divider />
		
		<view class="d-flex j-center  text-center j-sa mt-2">
			<!-- <view @tap="openhead(0, 'center')"> -->
			<view @tap="openhead()">
				<image :src="factory_info_data.head_url ? factory_info_data.head_url : '../../static/headimgurlerror.jpg'" class="img" />
				<view style="margin-top: -10rpx; color: #777;">头像</view>
			</view>
			<view @tap="opencode()">
				<image :src="factory_info_data.code_url ? factory_info_data.code_url : '../../static/headimgurlerror.jpg'" class="img" />
				<view style="margin-top: -10rpx; color: #777;">二维码</view>
			</view>
		</view>
		
		<openAlert BgColor="rgba(0,0,0,0.8)" ref="openAlerthead" :AlertClass="AlertClass" :AlertPosition="AlertPosition" >
			<image :src="factory_info_data.head_url ? factory_info_data.head_url : '../../static/headimgurlerror.jpg'" class="openimg"></image>
		</openAlert>

		<openAlert BgColor="rgba(0,0,0,0.8)" ref="openAlertcode" :AlertClass="AlertClass" :AlertPosition="AlertPosition">
			<image :src="factory_info_data.code_url ? factory_info_data.code_url : '../../static/headimgurlerror.jpg'" class="openimg"></image>
		</openAlert>

	</view>
</template>

<script>
	export default {
		props: {
			factory_info_data: null,
		},
		data() {
			return {
				AlertClass: 0,
				AlertPosition: '',
				head_url: ''
			}
		},
		methods: {
			//打开头像
			openhead() {
				if (!this.factory_info_data.head_url) {
					uni.showToast({
						title: '还未上传头像',
						icon: 'none'
					})
					return false
				}
				let imgsArray = [];
				imgsArray[0] = this.factory_info_data.head_url
				WeixinJSBridge.invoke("imagePreview",{
						current: imgsArray,
						urls: imgsArray
				});
				// uni.previewImage({
				// 	current: 0,
				// 	urls: imgsArray
				// });
			},

			//打开二维码
			opencode() {
				if (!this.factory_info_data.code_url) {
					uni.showToast({
						title: '还未上传二维码',
						icon: 'none'
					})
					return false
				}
				let imgsArray = [];
				imgsArray[0] = this.factory_info_data.code_url
				WeixinJSBridge.invoke("imagePreview",{
						current: imgsArray,
						urls: imgsArray
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
	@import '@/common/main.css';
	@import  '@/common/zcm-main.css';
	
	.invitetitle {
		display: flex;
		flex-direction: row;
		align-items: center;
		padding: 20rpx 0 10rpx 0;

		.invitetitle-em {
			height: 35rpx;
			width: 10rpx;
			background-color: #475dfc;
			border-radius: 50rpx;
		}

		.invitetitle-text {
			font-weight: bold;
			line-height: 35rpx;
			margin-left: 10rpx;
		}
	}

	.openimg {
		width: 600rpx;
		height: 600rpx;
		border-radius: 20rpx;
	}

	.img {
		border-radius: 5rpx;
		width: 150rpx;
		height: 150rpx;
		// margin-right: 30rpx;
	}
</style>
